'use strict';
/**
 * logic
 * @param  {} []
 * @return {}     []
 */
export default class extends think.logic.base {
  /**
	 * register action logic
	 * @return {} []
	 */
	registerAction() {
    this.allowMethods = "post"; //只允许 POST 请求类型
		let rules = {
			name: "required",
			password: "required|minLength:6"
		};
		let flag = this.validate(rules);
		if (!flag) {
			return this.fail("服务验证错误，请核对数据重试", this.errors());
		}
	}


	/**
	 * login action logic
	 * @return {} []
	 */
	loginAction() {
    this.allowMethods = "get,post"; //只允许 POST 请求类型
			let rules = {
				name: "required",
				password: "required|minLength:6"
			};
			let flag = this.validate(rules);
			if (!flag) {
				return this.fail("服务验证错误，请核对数据重试", this.errors());
			}
		}
}
